Repository navigation
fix(mcpx): separate hook stderr cap, stream the CI log formatter (#2880) - #5004
Conversation
…og formatter (#2880) Two CodeRabbit minors deferred from PR #2840, both still live on main. hooks: execute() pointed cmd.Stdout and cmd.Stderr at one cappedWriter, so a hook that filled the bound with stdout before writing its diagnostic had truncated stdout recorded as the failure text. Each stream now has its own capped writer and the failure text is stderr's first line, falling back to stdout's when stderr is empty (a hook that exits nonzero silently). Two tests: a hook that writes 70KB of stdout without a newline and then one stderr line reports the diagnostic, never the stdout; a quiet hook still reports its first stdout line. CI log formatter: the readable-output step appended every parsed go test -json event to a list and printed from it in two passes, retaining memory proportional to the whole stream. It now re-reads the file per pass through a generator. Output is byte-identical (checked against a fixture with a passing package, a failing test, and a non-JSON line).
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 55 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. CodeRabbit Verify
|
What
Both CodeRabbit minors deferred from PR #2840 (issue #2880), re-verified live on
mainate438032cd.1. Hook failure text: give stderr its own capped writer —
pkgs/mcpx/internal/hooks/runner.goexecute()pointedcmd.Stdoutandcmd.Stderrat one sharedcappedWriter, and the failure text wasfirstLine(out.String()). A hook that filled the bound (64 KiB) with stdout — no newline — before writing its one-line diagnostic to stderr had truncated stdout recorded as the error.Each stream now has its own
cappedWriter(same bound, so daemon memory is unchanged) and the failure text comes fromfailureText(stderr, stdout): stderr's first line, falling back to stdout's when stderr is empty.2. CI log formatter streams per pass —
.github/workflows/mcpx.ymlThe readable-output step appended every parsed
go test -jsonevent tolinesand printed from that list in two passes, retaining memory proportional to the whole stream. It now re-reads the file per pass through a generator (three passes: collect failing test names, print package-level output, print failing tests' output). Nothing is retained between passes.Tests
TestHookFailureTextPrefersTheStderrDiagnostic— hook writes 70 KB of stdout with no newline, thenboom: the diagnosticto stderr, exits 1:Stats().LastErrornames the diagnostic and contains no stdout.TestHookFailureTextFallsBackToStdout— a hook that exits nonzero with nothing on stderr still reports its first stdout line, as before.Verification
go test ./internal/hooks/ -count=1— okgo vet ./internal/hooks/— cleangofmt -lon the package — cleanCloses #2880.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.